<template>
  <div class="list-container">
    <div class="list-head">
      <img src="@/assets/images/back.png" alt="" class="back" @click="onBack">
      <span class="head-title">智慧终端</span>
    </div>
    <div class="content">
      <swiper class="swiper-container" :options="swiperOptions">
        <swiper-slide v-for="(item, i) in pdfs" :key="i" class="swiper-slide">
          <img :src="item.url" class="pdf-img" alt="">
        </swiper-slide>
      </swiper>
    </div>
  </div>
</template>

<script>
  import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
  import "swiper/css/swiper.css";
  export default {
    components: {
      Swiper,
      SwiperSlide,
    },
    data () {
      return {
        swiperOptions: {
          slidesPerView: 'auto',
          centeredSlides: true,
          spaceBetween: 20,
        },
        pdfs: []
      }
    },
    created() {
      this.getList()
    },
    methods: {
      onBack() {
        this.$router.go(-1)
      },
      getList() {
        this.$http.post("/newspaper/listByPage", { page: 1, limit: 999 }).then(res => {
          this.pdfs = res.data.records
        })
      }
    }
  }
</script>

<style lang="less" scoped>
.content{
  height: calc(100vh - .74rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: #fff;
  .swiper-container{
    height: 100%;
    width: 100%;
    .swiper-wrapper{
      position: relative;
      width: 100%;
      height: 100%;
      z-index: 1;
      display: flex;
    }
    .swiper-slide{
      width: 100%;
      height: calc(100vh - .74rem);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .pdf-img{
      display: block;
      width: 100%;
    }
  }
}
.list-head{
  background: rgb(156, 18, 13);
  height: .44rem;
  position: relative;
  text-align: center;
  .back{
    position: absolute;
    width: .26rem;
    height: .26rem;
    display: block;
    left: .12rem;
    top: .09rem;
  }
  .head-title{
    font-size: .16rem;
    line-height: .44rem;
    color: #fff;
  }
}
</style>